#pragma once

#include <sys/epoll.h>
#include<errno.h>
#include<cstring>
#include<unistd.h>
#include<vector>
#include<stdio.h>
#include <stdlib.h>
#include"Channel.h"

class Channel;
class Epoll
{
    
public:
    Epoll();
    ~Epoll();

    void addFd(int fd,uint32_t op);
    std::vector<Channel*> loop(int timeout =-1);

    void updateChannel(Channel* ch);
private:
    int epollfd_ = -1;
    static const int MAXEVENTNUM=10;
    struct epoll_event events_[MAXEVENTNUM];
};